import request from '@/config/axios'

// 学生 VO
export interface StudentVO {
  id: number // 编号
  classId: number // 班级ID
  studentName: string // 学生姓名
  sex: number // 性别
  avatar: string // 头像地址
  birthday: Date // 出生日期
  status: number // 状态
}

// 学生 API
export const StudentApi = {
  // 查询学生分页
  getStudentPage: async (params: any) => {
    return await request.get({ url: `/school/student/page`, params })
  },
  // 根据班级查询学生精简列表
  getSimpleStudentList: async (classId: number) => {
    return await request.get({ url: `/school/student/simple-list?classId=` + classId })
  },
  // 查询学生详情
  getStudent: async (id: number) => {
    return await request.get({ url: `/school/student/get?id=` + id })
  },

  // 新增学生
  createStudent: async (data: StudentVO) => {
    return await request.post({ url: `/school/student/create`, data })
  },

  // 修改学生
  updateStudent: async (data: StudentVO) => {
    return await request.put({ url: `/school/student/update`, data })
  },

  // 删除学生
  deleteStudent: async (id: number) => {
    return await request.delete({ url: `/school/student/delete?id=` + id })
  },

  // 导出学生 Excel
  exportStudent: async (params) => {
    return await request.download({ url: `/school/student/export-excel`, params })
  }
}
